﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemplatesPrint.DBHelper;
using TemplatesPrint.EntityHandle;
using TemplatesPrint.Entitys;
using TemplatesPrint.Tools;

namespace TemplatesPrint.Views
{
    public partial class FrmQryInfo : UIPage
    {
        decimal _allAmount = 0;
        public FrmQryInfo()
        {
            InitializeComponent();
        }

        private void FrmQryInfo_Initialize(object sender, EventArgs e)
        {
         
        }

        void LoadFrm(string qry)
        {
            _allAmount = 0;
            sc1.Panel1.Controls.Clear();
            sc1.Panel2.Controls.Clear();
            sc2.Panel1.Controls.Clear();
            sc2.Panel2.Controls.Clear();

            FrmJiaMengDian frmJiaMengDian = new FrmJiaMengDian("main", qry);
            sc1.Panel1.Controls.Add(frmJiaMengDian);
            frmJiaMengDian.Show();
            _allAmount = _allAmount+frmJiaMengDian.amount;

            FrmZongDaiLi frmJiaMengDian1 = new FrmZongDaiLi("main", qry);
            sc1.Panel2.Controls.Add(frmJiaMengDian1);
            frmJiaMengDian1.Show();
            _allAmount = _allAmount + frmJiaMengDian1.amount;

            FrmJianTui frmJiaMengDian2 = new FrmJianTui("main", qry);
            sc2.Panel1.Controls.Add(frmJiaMengDian2);
            frmJiaMengDian2.Show();
            _allAmount = _allAmount + frmJiaMengDian2.amount;

            FrmXinLingShou frmJiaMengDian3 = new FrmXinLingShou("main", qry);
            sc2.Panel2.Controls.Add(frmJiaMengDian3);
            frmJiaMengDian3.Show();
            _allAmount = _allAmount + frmJiaMengDian3.amount;

            lblAllAmount.Text = $"总金额:{_allAmount}";
        }

        private void usbtnQry_Click(object sender, EventArgs e)
        {
            LoadFrm(utxtQry.Text.Trim());
        }

        private void uiClear_Click(object sender, EventArgs e)
        {
            _allAmount = 0;
            utxtQry.Text = "";
            sc1.Panel1.Controls.Clear();
            sc1.Panel2.Controls.Clear();
            sc2.Panel1.Controls.Clear();
            sc2.Panel2.Controls.Clear();
            lblAllAmount.Text = $"总金额:{_allAmount}";
        }
    }
}
